package com.share.two.bio2;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Scanner;

public class Client {
	
	@SuppressWarnings("resource")
	public static void main(String[] args) throws Exception {
		
		Socket socket = new Socket("127.0.0.1", 12345);
		BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
		PrintStream ps = new PrintStream(socket.getOutputStream());
		
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入：");
		
		String nextLine = scanner.nextLine();
		System.out.println("client发送：  " + nextLine);
		ps.println(nextLine);
		
		String readLine = br.readLine();
		System.out.println("client接收： " + readLine);
		
		socket.close();
	}

}
